<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        v-model="form"
        v-bind="bindVal"
        v-on="onEvent"
        :page.sync="page"
        :permission="permissionList">
        <template slot="menuLeft">
          <el-button type="primary" size="small" @click="delBatch">删除</el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
  import baseCrud from '@/mixins/base-crud'
  import { delsObj } from "@/api/support/swstoperatelog";

  export default {
    name: "swstoperatelogguidang",
    mixins: [baseCrud('support/swstoperatelogguidang')],
    data() {
      return {
        params: {
          recordFlag: '1'
        }
      }
    },
    computed: {
      permissionList() {
        return {
          addBtn: this.vaildData(this.permissions.generator_sw_st_operate_log_add, false),
          delBtn: this.vaildData(this.permissions.generator_sw_st_operate_log_del, false),
          editBtn: this.vaildData(this.permissions.generator_sw_st_operate_log_edit, false)
        }
      }
    },
    methods: {
      delBatch: function() {
        if (this.$refs.crud.tableSelect.length < 1) {
          this.$message.info("请选择需要删除的记录");
          return false;
        }
        let ids = [];
        for (const table of this.$refs.crud.tableSelect) {
          ids.push(table.id);
        }
        this.$confirm("确认删除?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          delsObj(ids)
            .then(data => {
              this.$message.success("删除成功");
              this.getList(this.page);
              done();
            })
            .catch(() => {});
        });
      }
    }
  }
</script>
